<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Index extends CI_Controller {
    private $pk;
    private $title="";
    private $metakey="";
    private $metadesc='';
    private $dulieu='';
	 function  __construct(){
        parent::__construct();
        $this->load->library('session');
	}
	function index(){	    
	   $this->danhsachphongkham();
	}
    function danhsachphongkham(){
        $offset = $this->uri->segment(4,0);// chinh sua cai nay    
        $this->pk=array('data'=>array('idchuyenkhoa'=>1,'iddiadiem'=>'','offset'=>$offset,'phongkham'=>0,'benhvien'=>0));
        $data= array(
            'title'=>'',
            'metakey'=>'',
            'metadesc'=>''
            );
        
        $data['right']= 
                       $this->load->controller('mod_hotrotructuyen',array(),True).
                       $this->load->controller('mod_phongkhamvip',array(),True).//array('data'=>array('idchuyenkhoa'=>1,'iddiadiem',))
                       $this->load->controller('mod_quangcao',array(),True).
                       $this->load->controller('mod_tintuc_right',array(),True). 
                       $this->load->controller('mod_quangcao',array(),True);    
       $data['content'] =
                       $this->load->controller('mod_chuyenkhoa',array(),True).
                       $this->load->controller('mod_quangcao',array('id'=>3),True).
                       $this->load->controller('mod_news',array('param'=>1),True).
                       $this->load->controller('mod_news',array('param'=>1),True).
                       $this->load->controller('mod_news',array('param'=>1),True).
                       $this->load->controller('mod_quangcao',array('id2'=>3),True).
                       $this->load->controller('mod_danhsachphongkham',$this->pk,True);//offer lay bang uri
	   $data['seach']=$this->load->controller('mod_timkiem',array(),True);
       $this->load->view('frontend/template',$data);
    }
   function seach(){
        if(!empty($_POST)){
            $data1 = $this->security->xss_clean($_POST);            
            $data1['offset']='0';
        }
    }
    function thongtinbenh(){
        $this->session->set_userdata('trang','thongtinbenh');
        if(!empty($_POST)){
            $data1 = $this->security->xss_clean($_POST);
            $this->session->set_userdata($data1);
            $data1['trang']='thongtinbenh';
            $data1['offset']='0';
            $this->dulieu = array('dulieu'=>$data1);
 
        }else{ 
             $data1 =array('offset'=>0,'idbenh'=>$this->session->userdata('idbenh'),'thuoc'=>$this->session->userdata('thuoc'),'dinhduong'=>$this->session->userdata('dinhduong'),'trang'=>'thongtinbenh');
             $this->dulieu = array('dulieu'=>$data1);
        }
        $data= array(
            'title'=>'',
            'metakey'=>'',
            'metadesc'=>''
            ); 
       $this->load_views();               
    }
    function lienhe(){
        $data['seach']=$this->load->controller('mod_timkiem',array(),True);
        $data['right']= $this->load->controller('mod_hotrotructuyen',array(),True).
                       $this->load->controller('mod_phongkhamvip',array(),True).//array('data'=>array('idchuyenkhoa'=>1,'iddiadiem',))
                       $this->load->controller('mod_quangcao',array(),True).
                       $this->load->controller('mod_tintuc_right',array(),True). 
                       $this->load->controller('mod_quangcao',array(),True);    
       $data['content'] =
                       $this->load->controller('mod_lienhe',array(),True).                      
                       $this->load->controller('mod_danhsachphongkham',$this->pk,True);//offer lay bang uri
	   
       $this->load->view('frontend/template',$data); 
    }
    function thuoc(){
        $this->session->set_userdata('trang','thuoc');
        $data1 =array('offset'=>0,'idbenh'=>$this->session->userdata('idbenh'),'thuoc'=>$this->session->userdata('thuoc'),'dinhduong'=>$this->session->userdata('dinhduong'),'trang'=>'thuoc');
        $this->dulieu = array('dulieu'=>$data1);
        $data= array(
            'title'=>'',
            'metakey'=>'',
            'metadesc'=>''
            ); 
        $this->load_views(); 
    }
    function dinhduong(){
        $this->session->set_userdata('trang','dinhduong');
        $data1 =array('offset'=>0,'idbenh'=>$this->session->userdata('idbenh'),'thuoc'=>$this->session->userdata('thuoc'),'dinhduong'=>$this->session->userdata('dinhduong'),'trang'=>'dinhduong');
        $this->dulieu = array('dulieu'=>$data1);
        $data= array(
            'title'=>'',
            'metakey'=>'',
            'metadesc'=>''
            ); 
        $this->load_views();        
    }
    function load_views(){
        $data['seach']=$this->load->controller('mod_timkiem',array(),True);
        $data['right']= $this->load->controller('mod_hotrotructuyen',array(),True).
                       $this->load->controller('mod_phongkhamvip',array(),True).//array('data'=>array('idchuyenkhoa'=>1,'iddiadiem',))
                       $this->load->controller('mod_quangcao',array(),True).
                       $this->load->controller('mod_tintuc_right',array(),True). 
                       $this->load->controller('mod_quangcao',array(),True);    
       $data['content'] =
                       $this->load->controller('mod_ketquatimkiem',$this->dulieu,True).                      
                       $this->load->controller('mod_danhsachphongkham',$this->pk,True);//offer lay bang uri
	   
       $this->load->view('frontend/template',$data); 
    }
    function test(){
            $this->load->library('pagination');
            $config['base_url'] = 'http://localhost/phongkhamuytin/frontend/index/test/';
            $config['total_rows'] = 200;
            $config['per_page'] = 10;
            $config['uri_segment'] = 4;
            $config['num_links'] = 14;
            //$config['first_link'] = 'F1';
            //$config['first_tag_open'] = '<div class="dau">';//div cho chu F1
            //$config['first_tag_close'] = '</div>';//div cho chu F1
            //$config['last_link'] = 'Last';
            //$config['last_tag_open'] = '<div>';
            //$config['last_tag_close'] = '</div>';
            //-------next-
            //$config['next_link'] = '&gt;';
            //$config['next_tag_open'] = '<div>';
            //$config['next_tag_close'] = '</div>';
            //------------preview
            //$config['prev_link'] = '&lt;';
            //$config['prev_tag_open'] = '<div>';
            //$config['prev_tag_close'] = '</div>';
            //------------------cu?npage
            //$config['cur_tag_open'] = '<b>';
            //$config['cur_tag_close'] = '</b>';
            //--so 
            //$config['num_tag_open'] = '<div>';
            //$config['num_tag_close'] = '</div>';
            //-----
            $this->pagination->initialize($config);
            echo $this->pagination->create_links();
        }
    }